﻿using System;
using System.Xml;
using UnityEngine;

namespace EditorFrameWork
{
    public class XMLGUILayoutButton : XMLGUIBase
    {
        public string Label { get; set; }
        public event Action OnClick;

        public override void ParseXML(XmlElement xmlElement, XMLGUI roolXMLGUI)
        {
            base.ParseXML(xmlElement, roolXMLGUI);
            Label = xmlElement.InnerText;
        }

        public override void OnGUI(Rect position)
        {
            base.OnGUI(position);
            if (GUILayout.Button(Label))
            {
                OnClick?.Invoke();
            }
        }
    }
}